package com.zes.answers.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zes.answers.service.UserService;

/**
 * TODO 类描述
 *
 * @author honghe
 */
@RequestMapping("/users")
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/getUserById")
    @ResponseBody
    public Map<String,Object> getUserById(String id){
        Map<String,Object> resutl = new HashMap<>();
        resutl.put("code","100");
        resutl.put("user",userService.findUserById(Long.valueOf(id)));
        return resutl;
    }

    @RequestMapping("/getAllUser")
    @ResponseBody
    public Map<String,Object> getAllUser(){
        Map<String,Object> resutl = new HashMap<>();
        resutl.put("code","100");
        resutl.put("user",userService.findAllUser());
        return resutl;
    }
}
